package cn.iocoder.yudao.module.security.dal.mysql.warnlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.warnlog.SecurityWarnLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.warnlog.vo.*;

/**
 * 告警日志 Mapper
 *
 * @author cai
 */
@Mapper
public interface SecurityWarnLogMapper extends BaseMapperX<SecurityWarnLogDO> {

    default PageResult<SecurityWarnLogDO> selectPage(SecurityWarnLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SecurityWarnLogDO>()
                .likeIfPresent(SecurityWarnLogDO::getWarnName, reqVO.getWarnName())
                .eqIfPresent(SecurityWarnLogDO::getWarnDetail, reqVO.getWarnDetail())
                .eqIfPresent(SecurityWarnLogDO::getIpAddress, reqVO.getIpAddress())
                .betweenIfPresent(SecurityWarnLogDO::getWarnTime, reqVO.getWarnTime())
                .betweenIfPresent(SecurityWarnLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SecurityWarnLogDO::getId));
    }

}